package cate.game.role.fight;


import cp.solution.util.collection.ListKit;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

@NoteClass("我的某个阵型配置")
public class Position {

	@NoteField("第几编队")
	public byte posNum;

	@NoteField("选择的阵法tid")
	public int tid;

	@NoteField("英雄布阵信息")
	public List<HeroGrid> grids = new ArrayList<>();

	@NoteField(value = "圣器类型", detail = "0就是没有装备")
	public int hallowType;

	@NoteField("灵宠方案")
	public int holyPetIndex;

	public Position copy() {
		Position cp = new Position();
		cp.posNum = this.posNum;
		cp.tid = this.tid;
		cp.grids = ListKit.cloneList(grids, HeroGrid::copy);
		cp.hallowType = hallowType;
		cp.holyPetIndex = holyPetIndex;
		return cp;
	}

	public boolean containHero(String heroUid){
		for (HeroGrid grid : grids) {
			if(StringUtils.equals(grid.uid, heroUid)){
				return true;
			}
		}
		return false;
	}
}
